<template>
  <div class="energy-min-container" >
    <div class="energy-min-header">
      <EnergyMinHeaderCmp />
    </div>
    <div class="energy-min-main">
      <div class="energy-min-main-left">
        <EnergyMinLeftCmp :key="leftCmpKey" />
      </div>

      <div class="energy-min-main-middle">
        <EnergyMinMiddleCmp />
      </div>

      <div class="energy-min-main-right">
        <EnergyMinRightCmp :key="rightCmpKey" />
      </div>
    </div>
  </div>
</template>

<script>
import EnergyMinHeaderCmp from '../components/energy/EnergyMinHeaderCmp.vue';
import EnergyMinLeftCmp from '../components/energy/EnergyMinLeftCmp.vue';
import EnergyMinRightCmp from '../components/energy/EnergyMinRightCmp.vue';
import EnergyMinMiddleCmp from '../components/energy/EnergyMinMiddleCmp.vue';

export default {
  name: 'energyMin',
  data() {
    return {
      leftCmpKey: Math.random(),
      rightCmpKey: Math.random(),
    };
  },
  components: { 
    EnergyMinHeaderCmp,
    EnergyMinLeftCmp,
    EnergyMinRightCmp,
    EnergyMinMiddleCmp
  },
  mounted() {
    window.addEventListener("resize", this.resizeAll);
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.resizeAll);
  },
  methods: {
    resizeAll() {
      this.leftCmpKey = Math.random();
      this.rightCmpKey = Math.random();
    }
  },
};
</script>

<style lang="scss" scoped>
   .energy-min-container {
    width: 100%;
    height: 100%;
    overflow: hidden;

    .energy-min-header {
      width: 100%;
      height: 8.1%;
      background: rgba(15,45,75,0.2);
      border: 1px solid rgba(255,255,255,0.08);
    }

    .energy-min-main {
      height: 91.9%;
      display: flex;
      flex-direction: row;
      // padding-top: 20px;

      .energy-min-main-left {
        width: 400px;
        height: 100%;
        display: flex;
        flex-direction: column;
      }

      .energy-min-main-middle {
        flex: 1;
        margin-top: 20px;
        margin: 20px 20px 0 20px;
      }

      .energy-min-main-right {
        width: 400px;
        height: 100%;
        display: flex;
        flex-direction: column;
      }
    }
   }
</style>